package auto;

import org.openqa.selenium.By;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.edge.EdgeOptions;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2023-04-09
 * Time: 9:56
 */
public class AutoDemo6 {

    public void notHead() {
        // 自动化默认为 有头模式
        EdgeOptions options = new EdgeOptions();
        options.addArguments("--remote-allow-origins=*");

        // 设置浏览器参数为无头模式 , 需要在设置浏览器驱动之前
        EdgeDriver driver = new EdgeDriver(options);
        driver.get("https://www.baidu.com");
        driver.findElement(By.cssSelector("#kw")).sendKeys("刘亦菲");
        driver.findElement(By.cssSelector("#su")).click();
        driver.quit();
    }

    public static void main(String[] args) {
        AutoDemo6 autoDemo6 = new AutoDemo6();
        autoDemo6.notHead();
    }
}
